package com.pro.schedule.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pro.schedule.entity.EventType;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EventTypeMapper extends BaseMapper<EventType> {
    @Select("select * from event_type  where user_id = #{userId}")
    @Results(
            {
                    @Result(column = "event_type_id", property = "eventTypeId"),
                    @Result(column = "event_type_label", property = "eventTypeLabel"),
                    @Result(column = "event_type_color", property = "eventTypeColor"),
                    @Result(column = "user_id", property = "userId"),
                    @Result(column = "event_type_id", property = "eventTypeChildList", javaType = List.class,
                            many = @Many(select = "com.pro.schedule.mapper.EventTypeChildMapper.getEventTypeChildList")
                    )
            }
    )
    List<EventType> getEventTypeList(Long userId);

}
